﻿using B.S.DataBase.MyProject.Domain.KnowledgeManagements;
using B.S.DataBase.MyProject.ErrorCode;
using MediatR;
using MedicalPCTerminal.Read.API.Appcation.Commands.KnowledgeCommand;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore.Storage;
using StackExchange.Redis;

namespace MedicalPCTerminal.Read.API.Controllers
{
    /// <summary>
    /// 知识管理控制器-读
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class KnowledgeController : ControllerBase
    {
        /// <summary>
        /// 中介者
        /// </summary>
        private readonly IMediator mediator;



        public KnowledgeController(IMediator mediator)
        {
           
            this.mediator = mediator;
        }

        /// <summary>
        /// 查询知识管理--我的知识
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiPaging<KnowledgeManagement>> GetKnowledge([FromQuery]GetKnowledgeCommand request)
        {
            try
            {
              
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }




    }
}
